import requests


class RequestUtil:
    sess = requests.Session()

    def send_all_request(self, **kwargs):
        total_params = {
            "application": "app",
            "application_client_type": "h5"
        }  # test_shopxo.py接口用例中重复的params参数
        for key, value in kwargs.items():
            if key == "params":
                kwargs["params"].update(total_params)
                # 将params中添加total_params参数
                # 只要大部分有就加
            elif key == "files":
                for file_key, file_value in value.items():
                    value[file_key] = open(file_value, "rb")

        # 发送请求
        res = RequestUtil.sess.request(**kwargs)
        return res
